﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace ClassLibraryMessageDataType
{
    public class ClassMiddleDevData
    {
    }

    #region  base
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct MiddleDevMessageDataType_Base
    {
        public byte pHead;
        public byte direct;
        public ushort sq;
        public byte mainCMD;
        public byte subCMD;
        public ushort dataLen;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
        public byte[] data;
        public byte checksum;
        public byte pEned;
    }
    #endregion

    #region  请求设备编号
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct MiddleDevMessageDataType_BaseRequestDevCode
        {
            public byte pHead;
            public byte direct;
            public ushort sq;
            public byte mainCMD;
            public byte subCMD;
            public ushort dataLen;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
            public byte[] data;
            public byte checksum;
            public byte pEned;
        }
        #endregion

        #region 回复设备编号
        [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct MiddleDevMessageDataType_Returnquest
        {
            public UInt16 cmd;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
            public byte[] username;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
            public byte[] password;
        }
    #endregion

    //工步下发
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct MiddleDevMessageDataType_WorkSteps
    {
        public byte pHead;
        public byte direct;
        public ushort sq;
        public byte mainCMD;
        public byte subCMD;
        public ushort dataLen;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
        public byte[] data;
        public byte checksum;
        public byte pEned;
    }


    //工步停止

    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct MiddleDevMessageDataType_StopWorkSteps
    {
        public byte pHead;
        public byte direct;
        public ushort sq;
        public byte mainCMD;
        public byte subCMD;
        public ushort dataLen;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
        public byte[] data;
        public byte checksum;
        public byte pEned;
    }
    //reset 复位
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct MiddleDevMessageDataType_Reset
    {
        public byte pHead;
        public byte direct;
        public ushort sq;
        public byte mainCMD;
        public byte subCMD;
        public ushort dataLen;
        public byte checksum;
        public byte pEned;
    }

}
